PDFLATEX=pdflatex
BIBTEX=bibtex
OTT = ott
OTT_FLAGS := -tex_wrap false -tex_show_meta false -picky_multiple_parses false

all : pdf

pdf : main.pdf

main-output.tex : main.tex Makefile selfstar_unan.ott selfstar_ann.ott
	$(OTT) $(OTT_FLAGS) -tex_name_prefix annott -i selfstar_ann.ott -o selfstar_ann-inc.tex
	$(OTT) $(OTT_FLAGS) -i selfstar_unan.ott  -o selfstar_unan-inc.tex \
		-tex_filter main.tex main-output.tex

main.pdf : main-output.tex main.bib
	$(PDFLATEX) -jobname main main-output.tex
	$(BIBTEX)  main
	$(PDFLATEX) -jobname=main main-output.tex
	$(PDFLATEX) -jobname=main main-output.tex


clean :
	rm -f *.aux *.dvi *.ps *.log selfstar_unan-inc.tex main-output.tex *.bbl *.blg *~


annotated.tex: selfstar_ann.ott
	$(OTT) -tex_show_meta false -picky_multiple_parses false -i selfstar_ann.ott  -o selfstar_ann.tex

annotated.pdf: annotated.tex
	pdflatex selfstar_ann.tex
